package operation;

import book.Book;
import book.BookList;

/**
 * @program: 11.19
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-19 17:15
 **/
public class FindOperation implements IOperation{
    public void work(BookList bookList){
        System.out.println("查找图书");
        System.out.println("请输入你要找的书籍");
        String name=scanner.nextLine();
        int size=bookList.getUsedSize();
        int i = 0;
        for (; i <size ; i++) {
            Book book=bookList.getPos(i);
            if(name.equals(book.getName())){
                System.out.println("找到了这本书：信息如下");
                System.out.println(book);
                return;
            }
        }

            System.out.println("未找到");

    }
}
